/**
 * Event package.
 */
package fr.umlv.m2.ig.model.event;

import java.util.Collections;
import java.util.EventObject;
import java.util.List;

import fr.umlv.m2.ig.model.Train;

/**
 * This class defines the event for trains.
 * 
 * @author Gambouele Bertrand.
 * @author Viravout Alexandre.
 */
@SuppressWarnings("serial")
public class TrainEvent extends EventObject {

	/**
	 * Train concerned by this event.
	 */
	private final Train train;
	
	/**
	 * List of moved trains.
	 */
	private final List<Train> movedTrains;
	
	/**
	 * Creates a new {@code TrainEvent} object.
	 * 
	 * @param source source of the event.
	 * @param train train concerned by the event.
	 */
	public TrainEvent(final Object source, final Train train) {
		super(source);
		this.train = train;
		this.movedTrains = null;
	}
	
	/**
	 * Creates a new {@code TrainEvent} object.
	 * 
	 * @param source source of this event.
	 * @param movedTrains list of moved trains.
	 */
	public TrainEvent(final Object source, final List<Train> movedTrains) {
		super(source);
		this.train = null;
		this.movedTrains = Collections.unmodifiableList(movedTrains);
	}

	/**
	 * Creates a new {@code TrainEvent} object.
	 * 
	 * @param source source of this event.
	 */
	public TrainEvent(Object source) {
		super(source);
		this.train = null;
		this.movedTrains = null;
	}

	/**
	 * Returns the train concerned by this event.
	 * 
	 * @return the train concerned by this event.
	 */
	public Train getTrain() {
		return this.train;
	}

	/**
	 * Returns the list of moved trains.
	 * 
	 * @return the list of moved trains.
	 */
	public List<Train> getMovedTrains() {
		return movedTrains;
	}

}
